package com.qj.sys.controller;

import com.qj.redis.util.RedisShareLockUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author dlw
 * @date 2025-05-15 15:20
 */
@RestController
@RequestMapping("test")
@Slf4j
public class TestController {

    @Autowired
    private RedisShareLockUtil redisShareLockUtil;


    /**
     * @author dlw
     * @description: 独占锁测试
     * @date 2025/5/16 10:03
     */

    @GetMapping("/testRedisShareLock")
    public String testRedisShareLock() {
        boolean result = redisShareLockUtil.lock("qj", "123456", 10000L);
        log.info("分布式锁获取：{}", result);
        return String.valueOf(result);
    }

}
